import collections
class Solution(object):
    def checkInclusion(self, s1, s2):
        n1 = len(s1)
        n2 = len(s2)
        if n1 > n2:
            return False
        c1 = collections.Counter(s1)
        c2 = collections.Counter(s2[:n1])
        if not c1 - c2:
            return True
        for i in range(n2 - n1):
            c2[s2[i]] -= 1
            c2[s2[i + n1]] += 1
            if not c1 - c2:
                return True
        return False

